package org.csmz.class2333.innerclass;

public class Calculator {
    public void performCalculation(int num1,int num2,char operation){
        class OperationCalculation{
            public int add(){
                return num1 + num2;
            }
            public int subtract(){
                return num1 - num2;
            }
        }
        OperationCalculation calculation = new OperationCalculation();
        if (operation=='+'){
            System.out.println("计算结果："+calculation.add());
        }else if (operation=='-'){
            System.out.println("计算结果："+calculation.subtract());
        }else{
            System.out.println("发生错误！");
        }
    }
}
